//
//  KREmotionTool.m
//  cookBook
//
//  Created by kuroken on 16/1/20.
//  Copyright © 2016年 kuroken. All rights reserved.
//

#import "KREmotionTool.h"
#import "KREmotion.h"
#import <MJExtension.h>

@implementation KREmotionTool
+ (KREmotion *)emotionsWithChs:(NSString *)chs
{
    NSArray *emoji = [self emoji];
    for (KREmotion *emotion in emoji) {
        if ([emotion.chs isEqualToString:chs]) {
            return emotion;
        }
    }
    return nil;
}

static NSArray *_emoji;
+ (NSArray *)emoji
{
    if (!_emoji) {
        NSString *path = [[NSBundle mainBundle] pathForResource:@"emoji.plist" ofType:nil];
        _emoji = [KREmotion mj_objectArrayWithKeyValuesArray:[NSArray arrayWithContentsOfFile:path]];
    }
    return _emoji;
}

@end